<template>
  <div class="set-wrap">
    <div class="set-list">
      <div class="set-header">
        <span class="header-tips">Member</span>
        <el-button size="small" @click="addListWrapStatus = true">+</el-button>
      </div>
      <div class="set-item-list">
        <span class="item" :class="{active:active===n}" v-for="n in 50" @click="handleMenberClick(n)">
          <span class="member">{{n}}</span>
        </span>
      </div>
    </div>
    <div class="set-content">
      <editor :key="this.$store.state.editorRandKey" v-if="this.$store.state.redisData.content !== ''"></editor>
    </div>
  </div>
</template>

<script>
import editor from '@/views/content/editor/editor'

export default {
  name: "set_content",
  components: {
    editor
  },
  data() {
    return {
      active: 0
    }
  },
  created() {
    this.$store.commit('changeCurrentMode', 'raw')
  },
  methods: {
    handleMenberClick(member) {
      this.active = member
      this.$store.state.redisData.content = member
      this.$store.commit('changeEditorRandKey')
    }
  }
}
</script>

<style scoped lang="less">
@activeColor: rgba(66, 185, 131, 0.45);
.set-wrap {
  width: 100%;
  height: 100%;
  text-align: left;

  .set-list {
    position: relative;
    float: left;
    max-width: 20%;
    min-width: 300px;
    height: 100%;
    border-right: 1px solid #f5f5f5;

    .set-header {
      height: 5%;
      position: static;
      display: flex;
      align-items: center;
      vertical-align: middle;
      padding: 5px 15px;

      .header-tips {
        padding: 10px;
        flex: 1;
      }
    }

    .set-item-list {
      height: 93%;
      overflow: scroll;

      .item {
        display: block;
        height: 30px;
        padding: 5px;
        border: 1px solid #f5f5f5;

        &.active {
          background: @activeColor;
        }
        .member{
          padding: 20px;
        }
      }

    }

  }

  .set-content {
    float: left;
    max-width: 79%;
    width: calc(100% - 301px);
    height: 100%;
  }
}
</style>